//
// Created by cyrus on 1/28/24.
//

#ifndef GTEST_DEMOS_RUNTIME_STUB_H
#define GTEST_DEMOS_RUNTIME_STUB_H

#include "common/types.h"

#include <memory>

namespace bts {
class RuntimeStub {
 public:
  RuntimeStub() = default;
  virtual ~RuntimeStub() = default;
  static RuntimeStub *GetInstance();

  static void SetInstance(const std::shared_ptr<RuntimeStub> &instance) {
    instance_ = instance;
  }

  static void Reset() {
    instance_.reset();
  }

  // declare stub functions

  virtual Status rtMalloc(void **ptr, size_t size);

  virtual Status rtFree(void *ptr);

 private:
  static std::shared_ptr<RuntimeStub> instance_;
};
}  // namespace bts

#endif  // GTEST_DEMOS_RUNTIME_STUB_H
